package com.yphone.ui.main;

import com.google.gson.reflect.TypeToken;
import com.yphone.net.HttpConstants;
import com.yphone.net.IUIDataListener;
import com.yphone.net.bean.BaseResultWrapper;
import com.yphone.net.helper.ActivityHttpHelper;
import com.yphone.ui.login.manager.LoginManager;
import com.yphone.ui.login.respone.UserInfo;
import com.yphone.ui.ysj.bean.RemoteConnectBean;

import java.util.HashMap;
import java.util.List;

public class MainModel {

    private ActivityHttpHelper<BaseResultWrapper<List<RemoteConnectBean>>> httpHelper;

    public void requestInitDevice(IUIDataListener iuiDataListener_init){
        if (httpHelper == null){
            httpHelper = new ActivityHttpHelper<BaseResultWrapper<List<RemoteConnectBean>>>(new TypeToken<BaseResultWrapper<List<RemoteConnectBean>>>(){});
        }

        httpHelper.UpdateUIDataListener(iuiDataListener_init);
        HashMap<String, String> params = new HashMap<>();
        params.put("token", LoginManager.getInstance().getToken());
        httpHelper.sendPostRequest(HttpConstants.user_init_device,params,HttpConstants.TIME_OUT3);

    }

    public void updateDeviceName(String remark,String id){
        ActivityHttpHelper helper = new ActivityHttpHelper<BaseResultWrapper<Object>>(new TypeToken<BaseResultWrapper<Object>>(){});

        HashMap<String, String> params = new HashMap<>();
        params.put("token", LoginManager.getInstance().getToken());
        params.put("id",id);
        params.put("remark", remark);
        httpHelper.sendPostRequest(HttpConstants.updateDeviceRemark,params,HttpConstants.TIME_OUT3);
    }

}
